<template>

    <h2>添加房号信息</h2>
    
    
    <table class="table table-bordered">
            <tr>
                <th>房号名称</th>
                <th>
                    <input type="text" placeholder="请输入房号名称" v-model="TianJia1.Rnumber_Name">
                </th>
            </tr>
    
    
            <tr>
                <th>楼层</th>
                <th>
                    <input type="text" placeholder="请输入楼层" v-model="TianJia1.Rnumer_Floor">
                </th>
            </tr>
    
            <tr>
                <th>房间号</th>
                <th>
                    <input type="text" placeholder="请输入房间号" v-model="TianJia1.Rnumber_Num">
                </th>
            </tr>
    
            <tr>
                <th>房号状态</th>
                <th>
                    <input type="radio"  :value="true" v-model="TianJia1.Rnumer_State">可以入住
                    <input type="radio"  :value="false" v-model="TianJia1.Rnumer_State">打扫中
                </th>
            </tr>
    
            <tr>
                <th></th>
                <th>
                   <button class="btn btn-success" @click="TianJia">添加</button>
                </th>
            </tr>
    
    </table>
    
    </template>
    <script setup lang="ts">
    
    
    
    
    onMounted(()=>{
        FanTia();
    })
    
    
    
    import axios from 'axios';

    import { onMounted, ref } from 'vue';
    
    
    import { useRouter,useRoute,createRouter } from 'vue-router';
    
    const route=useRoute();
    const TianJia1 =ref({
        "Rnumber_id": route.params.id,
      "Rnumber_Name": "string",
      "Rnumer_Floor": 0,
      "Rnumber_Num": 0,
      "Rnumer_State": true,
      "Rnumber_IsDel": true,
      "RnumberDeleteTime": "2024-12-25T05:37:48.196Z"
    
    
    })
    
    
    const TianJia=()=>{
            axios.put('https://localhost:7035/api/T_Room/UpdateRomm',TianJia1.value).then(res=>{
    
                    if(res.data>0)
                    {
                        alert('修改成功')
                    }
                    else
                    {
                        alert('修改失败')
                    }
    
            })
    
    
    }
    



     const FanTia=()=>{

            axios.get('https://localhost:7035/api/T_Room/FanTianRoom',{params:{

                id:route.params.id
            }}).then(res=>{
            

                TianJia1.value=res.data

            })
        
     }



    
    </script>   